<%--
  Created by IntelliJ IDEA.
  User: 陈俊雄
  Date: 2018/7/10
  Time: 14:17
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<!-- Main view -->
<div class="animated fadeInRight">
    <div class="wrapper wrapper-content ng-scope">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{'REFUND_INQUIRY' | translate}}：</h5>
                    </div>
                    <div class="ibox-content sk-loading" ng-controller="transRefundCtrl">
                        <div class="sk-spinner sk-spinner-wave">
                            <div class="sk-rect1"></div>
                            <div class="sk-rect2"></div>
                            <div class="sk-rect3"></div>
                            <div class="sk-rect4"></div>
                            <div class="sk-rect5"></div>
                        </div>
                        <form name="myForm">
                            <div class="row">
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <div class="input-group-btn" uib-dropdown>
                                                <button class="btn btn-white btn-sm" style="margin-bottom: 0"
                                                        uib-dropdown-toggle type="button">
                                                    {{orderTypeTxt}}
                                                    <span class="caret"></span>
                                                </button>
                                                <ul uib-dropdown-menu>
                                                    <li>
                                                        <a href="" ng-click="orderSwitch($event, 0)">平台订单号</a>
                                                    </li>
                                                    <li>
                                                        <a href="" ng-click="orderSwitch($event, 1)">商户订单号</a>
                                                    </li>
                                                </ul>
                                            </div>
                                            <input type="text" class="form-control" ng-model="searchInfo.id">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">域名：</span>
                                            <select class="form-control b-r-sm" ng-model="searchInfo.siteId"
                                                    ng-options="x.id as x.siteUrl for x in siteUrls">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">邮箱：</span>
                                            <input type="email" class="form-control" ng-model="searchInfo.email">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">退款类型：</span>
                                            <select class="form-control"
                                                    ng-model="searchInfo.changeType"
                                                    ng-options="x.firstValue as x.name for x in changeType">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">退款状态：</span>
                                            <select class="form-control"
                                                    ng-model="searchInfo.changeStatus"
                                                    ng-options="x.firstValue as x.name for x in auditedStatus">
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">交易时间：</span>
                                            <input type="text" name="startDate"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker1()"
                                                   uib-datepicker-popup="{{format}}" ng-model="searchInfo.startDate"
                                                   is-open="popup1.opend"
                                                   datepicker-options="dateOptions1"
                                                   alt-input-formats="altInputFormats"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker1()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-1-5">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">结束日期：</span>
                                            <input type="text" name="endDate"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker2()"
                                                   uib-datepicker-popup="{{format}}" ng-model="searchInfo.endDate"
                                                   is-open="popup2.opend"
                                                   datepicker-options="dateOptions2"
                                                   alt-input-formats="altInputFormats"
                                                   ng-disabled="endDateDisable"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker2()"
                                                    ng-disabled="endDateDisable">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6 col-md-6 col-lg-3 col-lg-offset-3">
                                    <button type="submit" class="btn btn-sm btn-w-m btn-primary pull-right"
                                            ng-click="searchOrder()">
                                        查询
                                    </button>
                                </div>
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <button type="button" class="btn btn-sm btn-w-m btn-info"
                                            ng-click="resetForm()">
                                        重置
                                    </button>
                                </div>
                                <div class="pull-right col-sm-6 col-md-6 col-lg-3">
                                    <button type="button" class="pull-right btn btn-sm btn-sm btn-success"
                                            ng-click="exportOrderChange()">
                                        <i class="fa fa-download">&nbsp;导出Excel</i>
                                    </button>
                                </div>
                            </div>
                        </form>
                        <div class="table-responsive">
                            <table ng-table="refundTable"
                                   class="table table-condensed table-striped table-hover table-bordered">
                                <tr ng-repeat="row in $data">
                                    <td class="text-center" data-title="'订单号'">
                                        {{row.orderId}}
                                    </td>
                                    <td class="text-center" data-title="'商户号'">
                                        (${sessionScope.merchantInfo.id})&nbsp${sessionScope.merchantInfo.name}
                                    </td>
                                    <td class="text-center" data-title="'商户订单号'">
                                        {{row.merOrderId}}
                                    </td>
                                    <td class="text-center" data-title="'域名'">
                                        {{row.siteId | getValueByList : siteUrls : 'id' : 'siteUrl'}}
                                    </td>
                                    <td class="text-center" data-title="'订单金额'">
                                        {{row.amount | currency:row.currency}}
                                    </td>
                                    <td class="text-center" data-title="'人名币金额'">
                                        {{row.rmbAmount | currency:'CNY'}}
                                    </td>
                                    <td class="text-center" data-title="'交易时间'">
                                        {{row.tradeTime | date:'yyyy-MM-dd hh:mm:ss:sss'}}
                                    </td>
                                    <td class="text-center" data-title="'退款金额'">
                                        {{row.amount | number:2}}
                                    </td>
                                    <td class="text-center" data-title="'退款人民币金额'">
                                        {{row.rmbAmount | number:2}}
                                    </td>
                                    <td class="text-center" data-title="'退款手续费'">
                                        {{row.refundFee | currency:'CNY'}}
                                    </td>
                                    <td class="text-center" data-title="'退款原因'">
                                        {{row.reasons}}
                                    </td>
                                    <td class="text-center" data-title="'退款申请时间'">
                                        {{row.applicationTime | date:'yyyy-MM-dd hh:mm:ss:sss'}}
                                    </td>
                                    <td class="text-center" data-title="'异常状态'">
                                        {{row.type | getValueByList : exceptionStatus : 'firstValue' : 'name'}}
                                    </td>
                                    <td class="text-center" data-title="'审核结果'">
                                        {{row.status | getValueByList : auditedStatus : 'firstValue' : 'name'}}
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <my-pagination table-param="refundTable"></my-pagination>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>